package cn.xingyun.pickaxe_loli_new.command;

import cn.xingyun.pickaxe_loli_new.item.LolipickaxeItem;
import com.mojang.brigadier.arguments.BoolArgumentType;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.server.commands.GameModeCommand;
import net.minecraft.server.commands.GameRuleCommand;
import net.minecraft.server.commands.KillCommand;
import net.minecraft.world.item.PickaxeItem;
import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class MyCommand {
    public static short mode = 0;
    @SubscribeEvent
    public static void onCommand(RegisterCommandsEvent event) {
        event.getDispatcher().register(Commands.literal("pickaxe_loli_new")
                /*.then(Commands.literal("noSpawn")
                        .then(Commands.argument("value",BoolArgumentType.bool()).executes((commandContext -> {
                            LolipickaxeItem.worldNoSpawn = BoolArgumentType.getBool(commandContext, "value");
                            commandContext.getSource().getServer().sendSystemMessage(Component.translatable("禁生成:"+BoolArgumentType.getBool(commandContext,"value")));
                            mode = 1;
                            return mode;
                        }))))*/
                .then(Commands.literal("noScreen")
                        .then(Commands.argument("value",BoolArgumentType.bool()).executes((commandContext -> {
                            LolipickaxeItem.noScreen = BoolArgumentType.getBool(commandContext, "value");
                            commandContext.getSource().getServer().sendSystemMessage(Component.translatable("禁制Screen:"+BoolArgumentType.getBool(commandContext,"value")));
                            mode = 2;
                            return mode;
                                }))))
                .then(Commands.literal("unClearbable")
                        .then(Commands.argument("value",BoolArgumentType.bool()).executes((commandContext -> {
                            LolipickaxeItem.unClearable = BoolArgumentType.getBool(commandContext, "value");
                            commandContext.getSource().getServer().sendSystemMessage(Component.translatable("防清除模式:"+BoolArgumentType.getBool(commandContext,"value")));
                            mode = 3;
                            return mode;
                        }))))
                .then(Commands.literal("StrongeRemove")
                        .then(Commands.argument("value",BoolArgumentType.bool()).executes((commandContext -> {
                            LolipickaxeItem.strongerRemove = BoolArgumentType.getBool(commandContext, "value");
                            commandContext.getSource().getServer().sendSystemMessage(Component.translatable("强行清除模式:"+BoolArgumentType.getBool(commandContext,"value")));
                            mode = 3;
                            return mode;
                        }))
        )));
    }
}
